package com.example.bigwork.mapper;

import com.example.bigwork.entity.Order;
import com.example.bigwork.enums.OrderStatus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Optional;

@Mapper
public interface OrderMapper {
    int insertOrder(Order order); // MyBatis will set the generated ID back to the order object
    Optional<Order> findById(@Param("id") Long id);
    Optional<Order> findByOrderNumber(@Param("orderNumber") String orderNumber);
    List<Order> findByUserId(@Param("userId") Long userId);
    int updateOrderStatus(@Param("id") Long id, @Param("status") OrderStatus status);
}
